//Documentation complete
/**
 * @author Alex
 * @version 2009MR27
 */

package ui.internal;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;

/**
 * Servlet for patron logout procedures.
 */
public class Logout extends HttpServlet {
	
	/* Constants */
	
	private static final long serialVersionUID = -6160655174887989052L;
	
	/* END Constants */
	
	
	/* (HttpServlet) Methods */

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)	throws ServletException, IOException {
		HttpSession session = request.getSession(false);
		if (session != null)
			session.invalidate();

		String redirect = request.getParameter("redirect");
		if (redirect != null)
			response.sendRedirect(redirect);
		else
			response.sendRedirect("login.jsp");
	}
	
	/* END (HttpServlet) Methods */
	
}
